import React, { Suspense } from "react";
import routes from "./routes";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import { render } from "@testing-library/react";

const renderView = (routes) => {
  return routes.map((v, i) => {
    return <Route path={v.path} element={v.element} key={i}></Route>;
  });
};

const Index: React.FC = () => {
  return (
    <BrowserRouter>
      <Suspense>
        <Routes>{renderView(routes)}</Routes>
      </Suspense>
    </BrowserRouter>
  );
};

export default Index;
